package com.example.springboot.MyBatis.controller;

import com.example.springboot.MyBatis.Vo.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;


@Component
@RestController
@RequestMapping("/test01")
public class Test01 {

    @GetMapping("/t1")
    public String t1(){
        System.out.println("this is t1");
        return "this is t1 ,and this is /test01/t1, and this is test/test01/t1";
    }

    @RequestMapping(value = "/t2",method = RequestMethod.POST)
    @ResponseBody
    public String t2(@RequestBody User user){
        System.out.println("this is t2,and "+user.getId()+" and "+user.getName());
        return "this is t2,and "+user.getId()+" and "+user.getName();
    }

    @RequestMapping(value = "/t3/{id}",method = RequestMethod.POST)
    @ResponseBody
    public String t3(@PathVariable Integer id){
        System.out.println("this is t3,and "+id);
        return "this is t3 and "+id;
    }

}

